
<?php
    $url = new Url();
?>

<script type="text/javascript">

    loadBoxKetQua();

    loadBoxTienIch();

    loadBoxThongke();

    $(document).ready(function() {

        $('#thongke').addClass('active');

        loadChat("<?=$url->createUrl('home/chat')?>");

        $('.From').keypress(function(e){
            if(e.keyCode == 13 && !e.shiftKey){
                $(this).trigger("enterKey");
            } 
        });

        $('textarea').bind("enterKey",function(e){
            var messenger = $('.From').val();
            var url = "<?=$url->createUrl('home/chat'); ?>";
            $.ajax({
                type: "GET",
                url: url,
                global: false,
                data: {
                    messenger: messenger,
                },
                success: function(msg){  
                    if(msg==1){
                        alert('Bạn phải đăng nhập để tán gẫu');
                    }
                    else
                    {
                        $("#CHAT").html(msg);
                        $('.From').val('');
                    }

                }
            });
        });

        $(".tableTK ul li").each(function(){
            $(this).find(".line_boxTK2").animate({
                width:$(this).attr("data")
                },6000);
        });

    });

    function loadChat(url){
        $.ajax({
            type: "POST",
            url: url,
            global: false,
            data:{},
            success:function(msg){
                $("#CHAT").html(msg);
            }
        });
    }

    function messenger(){
        var messenger = $('.From').val();
        var url = "<?=$url->createUrl('home/chat'); ?>";
        $.ajax({
            type: "GET",
            url: url,
            global: false,
            data: {
                messenger: messenger,
            },
            success: function(msg){
                if(msg==1){
                    alert('Bạn phải đăng nhập để tán gẫu');
                }
                else
                {
                    $("#CHAT").html(msg);
                    $('.From').val('');
                } 
            }
        });
    };

    function loadBoxTienIch(){
        var url = "<?=$url->createUrl('home/boxtienich');?>";
        $.ajax({
            type: "POST",
            url: url,
            global: false,
            data:{},
            success: function(msg){
                $("#boxtienich").html(msg);
            }
        });
    }

    function loadBoxThongke(){
        var url = "<?=$url->createUrl('home/boxthongke');?>";
        $.ajax({
            type: "POST",
            url: url,
            global: false,
            data:{},
            success: function(msg){
                $("#boxthongke").html(msg);
            }
        });
    }

    function loadBoxKetQua(){
        var url = "<?=$url->createUrl('home/boxketqua');?>";
        $.ajax({
            type: "POST",
            url: url,
            global: false,
            data:{},
            success: function(msg){
                $("#boxketqua").html(msg);
            }
        });
    }

</script>

<div class="leftMain">
    <div class="titleCHAT">
        <h1>Thống kê nhanh Xổ số Miền Bắc</h1>
    </div>
    <div class="TK">
        <div class="titleTK" id="nhieunhat">
            12 bộ số ra nhiều nhất trong 10 ngày qua
        </div>
        <div class="lineTK">
            <div class="lineTK2"></div>
        </div>
        <div class="tableTK">
            <ul>

                <?php for($i=0;$i<count($bosoranhieu);$i++){ ?>
                    <li data="<?php echo $bosoranhieu[$i]['percent'];?>%">
                        <div class="numberTK_1">
                            <div class="boxTK_1">
                                <?php echo $bosoranhieu[$i]['sl'];?> lần
                            </div>
                            <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrow4.png" width="4" height="7" class="boxTK_icon" />    
                            <div class="boxTK_2"><?php echo $bosoranhieu[$i]['boso'];?></div>
                        </div>
                        <div class="numberTK_2">
                            <div class="line_boxTK">
                                <div class="line_boxTK2"></div>
                            </div>
                        </div>
                        <div class="numberTK_3">
                            <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrow5.png" width="6" height="9" class="boxTK_icon2" />
                            <div class="boxTK_3">
                                <?php echo $bosoranhieu[$i]['percent'];?>%
                            </div>
                        </div>
                        <div class="both"></div>
                    </li>
                    <?php }?>

            </ul>
        </div>
        <div class="titleTK" id="itnhat">
            12 bộ số ra ít nhất trong 10 ngày qua
        </div>
        <div class="lineTK">
            <div class="lineTK2"></div>
        </div>
        <div class="tableTK">
            <ul>

                <?php for($i=0;$i<count($bosorait);$i++){?>
                    <li data="<?php echo $bosorait[$i]['percent'];?>%">
                        <div class="numberTK_1">
                            <div class="boxTK_1">
                                <?php echo $bosorait[$i]['sl']; ?> lần
                            </div>
                            <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrow4.png" width="4" height="7" class="boxTK_icon" />    
                            <div class="boxTK_2"><?php echo $bosorait[$i]['boso']?></div>
                        </div>
                        <div class="numberTK_2">
                            <div class="line_boxTK">
                                <div class="line_boxTK2"></div>
                            </div>
                        </div>
                        <div class="numberTK_3">
                            <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrow5.png" width="6" height="9" class="boxTK_icon2" />
                            <div class="boxTK_3">
                                <?php echo $bosorait[$i]['percent'];?>%
                            </div>
                        </div>
                        <div class="both"></div>
                    </li>
                    <?php }?>

            </ul>
        </div>
        <div class="titleTK" id="lientiep">
            Những bộ số ra liên tiếp (Lô rơi)
        </div>
        <div class="lineTK">
            <div class="lineTK2"></div>
        </div>
        <div class="tableTK">

            <?php for($i=0;$i<count($bosolientiep);$i++){?>
                <div class="numberTK_1">
                    <div class="boxTK_1">
                        <?php echo $bosolientiep[$i]['dodai_chuky'];?> lần
                    </div>
                    <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrow4.png" width="4" height="7" class="boxTK_icon" />    
                    <div class="boxTK_2"><?php echo $bosolientiep[$i]['boso'];?></div>
                </div>
                <?php }?>

            <div class="both"></div>
        </div>
        <div class="titleTK" id="gan">
            Những bộ số gan trên 10 ngày trở lên
        </div>
        <div class="lineTK">
            <div class="lineTK2"></div>
        </div>
        <div class="tableTK">

            <?php for($i=0;$i<count($bosokhan);$i++){?>
                <div class="numberTK_1">
                    <div class="boxTK_1">
                        <?php echo $bosokhan[$i]['so_ngay'];?> lần
                    </div>
                    <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrow4.png" width="4" height="7" class="boxTK_icon" />    
                    <div class="boxTK_2"><?php echo $bosokhan[$i]['boso'];?></div>
                </div>
                <?php }?>

            <div class="both"></div>
        </div>
        <div class="titleTK" id="dauso">
            Thống kê đầu số xuất hiện trong 10 ngày qua:</div>
        <div class="lineTK">
            <div class="lineTK2"></div>
        </div>
        <div class="tableTK">
            <ul>

                <?php for($i=0;$i<count($arr_dau);$i++){?>
                    <li data="<?php echo $arr_dau[$i]['percent'];?>%">
                        <div class="numberTK_1">
                            <div class="boxTK_1">
                                <?php echo $arr_dau[$i]['sl'];?> lần
                            </div>
                            <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrow4.png" width="4" height="7" class="boxTK_icon" />    
                            <div class="boxTK_2"><?php echo $arr_dau[$i]['dau_so'];?></div>
                        </div>
                        <div class="numberTK_2">
                            <div class="line_boxTK">
                                <div class="line_boxTK2"></div>
                            </div>
                        </div>
                        <div class="numberTK_3">
                            <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrow5.png" width="6" height="9" class="boxTK_icon2" />
                            <div class="boxTK_3">
                                <?php echo $arr_dau[$i]['percent'];?>%
                            </div>
                        </div>
                        <div class="both"></div>
                    </li>
                    <?php }?>

            </ul>
        </div>
        <div class="titleTK" id="duoiso">
            Thống kê đuôi số xuất hiện trong 10 ngày qua:
        </div>
        <div class="lineTK">
            <div class="lineTK2"></div>
        </div>
        <div class="tableTK">
            <ul>

                <?php for($i=0;$i<count($arr_dit);$i++){?>
                    <li data="<?php echo $arr_dit[$i]['percent'];?>%">
                        <div class="numberTK_1">
                            <div class="boxTK_1">
                                <?php echo $arr_dit[$i]['sl'];?> lần
                            </div>
                            <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrow4.png" width="4" height="7" class="boxTK_icon" />    
                            <div class="boxTK_2"><?php echo $arr_dit[$i]['dit_so'];?></div>
                        </div>
                        <div class="numberTK_2">
                            <div class="line_boxTK">
                                <div class="line_boxTK2"></div>
                            </div>
                        </div>
                        <div class="numberTK_3">
                            <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrow5.png" width="6" height="9" class="boxTK_icon2" />
                            <div class="boxTK_3">
                                <?php echo $arr_dit[$i]['percent'];?>%
                            </div>
                        </div>
                        <div class="both"></div>
                    </li>
                    <?php }?>

            </ul>
        </div>
    </div>

    <div class="CHAT">
        <div class="titleCHAT">
            Tán Gẫu
        </div>
        
        <div class="CHATarea">
            <textarea name="CHAT" placeholder="Nhập nội dung chat" cols="50" rows="1" class="From"></textarea>
        </div>
        <div style="padding:15px 20px 20px 0; text-align:right;">
            <a href="javascript:void(0);" onclick="loadChat('<?=$url->createUrl('home/chat')?>');"><img src="<?php echo Yii::app()->params['static_url'];?>images/Refresh.png" width="22" height="22" style="padding-right:10px;" /></a>
            <input type="button" onclick="messenger();" class="button_KQ" value="Gửi">
        </div>

        <div class="boxCHAT" id="CHAT">  

        </div>
    </div>

</div>
<div class="rightMain">

    <div class="Box" id="boxthongke"></div>

    <div class="Box" id="boxtienich"></div>

    <div class="Box" id="boxketqua"></div>

        </div>
        <div class="both"></div>